#!/bin/bash

#Panel for BigLinux
#
#Authors:
#  Bruno Goncalves Araujo <www.biglinux.com.br>
#
#License: GPLv2 or later
#################################################


. /usr/share/bigcontrolcenter/default/theme-categories.sh.htm

#Translation
export TEXTDOMAINDIR="/usr/share/locale-langpack"
export TEXTDOMAIN=bigcontrolcenter-hardware-video


echo '
<script language="JavaScript">
window.resizeTo(640,480);
function NoResize(){
  window.resizeTo(640,480);
}
</script>
'

title=$"Video e monitor"
apply=$"Aplicar"
close=$"Sair"
tip_resolucao=$"Configure de acordo com suas preferencias."
tip_randrtray=$"Se voce necessita alterar a resolucao diversas vezes essa e a melhor opcao.<br>Apos abrir o aplicativo o mesmo permanece no sistema de notificacoes perto do relogio."
tip_energia=$"Estabeleca tempos para deixar o monitor em modo de espera ou para desliga-lo."
tip_xinerama="Se o computador possui mais de um monitor utilize essa opcao para atingir a configuracao de sua preferencia."
tip_jockey=$"Placas de video NVIDIA e ATI em geral funcionam melhor com os drivers proprietarios, instale-os ou remova-os com essa opcao."
tip_bigxorg=$"Selecione manualmente o driver a ser utilizado, force resolucoes que os outros configuradores nao estao aceitando, faca configuracoes avancadas ou restaure a configuracao padrao do sistema."
tip_cor=$"Ajuste as cores e o brilho de acordo com sua preferencia"
tip_ati=$"Configurador oficial para placas ATI"
tip_nvidia=$"Configurador oficial para placas NVIDIA"


. /usr/share/bigcontrolcenter/default/theme.sh.htm

cat << EOF
	<script type="text/javascript" src="/usr/share/bigcontrolcenter/default/js/jquery-1.3.2.min.js"></script>


	<script type="text/javascript">
	\$(function() {
		\$("#tabs").tabs({
			event: 'mouseover'
		})
	});

	if (document.images) {
	buttonUp = new Image(); buttonUp.src = "/usr/share/bigcontrolcenter/default/images/category-background.png";
	buttonDown = new Image(); buttonDown.src = "$(echo $HOME)/.bigcontrolcenter/category-background-over.png";
	}

	function turn_off(cell) {
	if (document.images != null) {
	cell.style.backgroundImage = "url('" + buttonUp.src + "')";
	}
	}

	function turn_on(cell) {
	if (document.images != null) {
	cell.style.backgroundImage = "url('" + buttonDown.src + "')";
	}
	}

  </script>





EOF

echo "<title>$title</title><body onResize=\"NoResize();\">"

#header
open_header
echo "$title" '</font><br>' $"Configure o monitor e a placa de video."
close_header



echo "<TABLE align=center><tr><td>"
    echo "<a href=\"file:///usr/share/bigbashview/run.run?kcmshell4=randr\"" "$mouseover_open" $tip_resolucao "$mouseover_close>""<table onmouseout=\"turn_off(this)\" onmouseover=\"turn_on(this)\" $bigbash_categories_background_config background=$bigbash_categories_background><tr><td width=30><img src=resolucao.png></td>"'<td valign="middle">'"$bigbash_categories_font" $"Resolucao, atualizacao e rotacao" " </font></td></tr></table></a>"
echo '</td><td width=100%></td><td>'
    echo "<a href=\"file:///usr/share/bigbashview/run.run?/usr/share/bigcontrolcenter/categories/hardware/video/randr\"" "$mouseover_open" $tip_randrtray "$mouseover_close>""<table onmouseout=\"turn_off(this)\" onmouseover=\"turn_on(this)\" $bigbash_categories_background_config background=$bigbash_categories_background><tr><td width=30><img src=randr.png></td>"'<td valign="middle">'"$bigbash_categories_font" $"Aplicativo para alteracao rapida de resolucao" " </font></td></tr></table></a>"
echo '</td></tr><tr><td>'
    echo "<a href=\"file:///usr/share/bigbashview/run.run?kcmshell4=kgamma\"" "$mouseover_open" $tip_cor "$mouseover_close>""<table onmouseout=\"turn_off(this)\" onmouseover=\"turn_on(this)\" $bigbash_categories_background_config background=$bigbash_categories_background><tr><td width=30><img src=cor.png></td>"'<td valign="middle">'"$bigbash_categories_font" $"Cor e brilho" " </font></td></tr></table></a>"
echo '</td><td width=100%></td><td>'
    echo "<a href=\"file:///usr/share/bigbashview/run.run?jockey-gtk\"" "$mouseover_open" $tip_jockey "$mouseover_close>""<table onmouseout=\"turn_off(this)\" onmouseover=\"turn_on(this)\" $bigbash_categories_background_config background=$bigbash_categories_background><tr><td width=30><img src=jockey.png></td>"'<td valign="middle">'"$bigbash_categories_font" $"Gerenciar drivers proprietarios" " </font></td></tr></table></a>"
echo '</td></tr><tr><td>'
    echo "<a href=\"file:///usr/share/bigbashview/run.run?bigbashview=/usr/share/bigcontrolcenter/categories/hardware/video/bigvideo.sh.htm -i /usr/share/bigcontrolcenter/categories/hardware/video/icon.png\"" "$mouseover_open" $tip_bigxorg "$mouseover_close>""<table onmouseout=\"turn_off(this)\" onmouseover=\"turn_on(this)\" $bigbash_categories_background_config background=$bigbash_categories_background><tr><td width=30><img src=bigxorg.png></td>"'<td valign="middle">'"$bigbash_categories_font" $"Configuracoes avancadas e restauracao de configuracoes" " </font></td></tr></table></a>"
echo '</td><td width=100%></td><td>'
    echo "<a href=\"file:///usr/share/bigbashview/run.run?kcmshell4=xinerama\"" "$mouseover_open" $tip_xinerama "$mouseover_close>""<table onmouseout=\"turn_off(this)\" onmouseover=\"turn_on(this)\" $bigbash_categories_background_config background=$bigbash_categories_background><tr><td width=30><img src=xinerama.png></td>"'<td valign="middle">'"$bigbash_categories_font" $"Configurar o uso de multiplos monitores" " </font></td></tr></table></a>"
echo '</td></tr><tr><td>'

if [ -e "/usr/bin/nvidia-settings" ]
then
    echo "<a href=\"file:///usr/share/bigbashview/run.run?bigsudo=/usr/share/bigcontrolcenter/categories/hardware/video/nvidia\"" "$mouseover_open" $tip_nvidia "$mouseover_close>""<table onmouseout=\"turn_off(this)\" onmouseover=\"turn_on(this)\" $bigbash_categories_background_config background=$bigbash_categories_background><tr><td width=30><img src=nvidia.png></td>"'<td valign="middle">'"$bigbash_categories_font" $"Configurador especial para placas NVIDIA" " </font></td></tr></table></a>"
echo '</td><td width=100%></td><td>'
fi

if [ -e "/usr/bin/amdcccle" ]
then
    echo "<a href=\"file:///usr/share/bigbashview/run.run?amdcccle\"" "$mouseover_open" $tip_ati "$mouseover_close>""<table onmouseout=\"turn_off(this)\" onmouseover=\"turn_on(this)\" $bigbash_categories_background_config background=$bigbash_categories_background><tr><td width=30><img src=ati.png></td>"'<td valign="middle">'"$bigbash_categories_font" $"Configurador especial para placas ATI" " </font></td></tr></table></a>"
fi

echo '</table>'


echo "</a></td></tr></table></div><div id=\"rodape\"><button type=button value= $close onClick= parent.location='/usr/share/bigbashview/exemplo2.sh.htm?close=True'>   <img src=\"/usr/share/bigcontrolcenter/default/images/cancel.png\" style=\"vertical-align:top\"  />  $close     </button></div>"

